﻿<UserControl x:Class="Berico.SnagL.Infrastructure.Modularity.Toolbar.CircleToolbarItemExtensionView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows" 
    mc:Ignorable="d"
    d:DesignHeight="35" d:DesignWidth="35">
    
    <!-- TODO: SWITCH TO USE THEME -->
    <UserControl.Resources>
        <Style x:Key="RadioButtonStyle" TargetType="RadioButton">
            <!--<Setter Property="IsEnabled" Value="true"/>-->
            <Setter Property="IsTabStop" Value="true"/>
            <Setter Property="Background" Value="#FFA9A9A9"/>
            <Setter Property="Foreground" Value="#FF000000"/>
            <Setter Property="MinWidth" Value="5"/>
            <Setter Property="MinHeight" Value="5"/>
            <Setter Property="Margin" Value="0"/>
            <Setter Property="HorizontalAlignment" Value="Left" />
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Cursor" Value="Hand"/>
            <!--<Setter Property="TextAlignment" Value="Left"/>
            <Setter Property="TextWrapping" Value="NoWrap"/>-->
            <!--<Setter Property="FontWeight" Value="Bold" />-->
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="RadioButton">
                        <Grid>
                            <Grid.Resources>
                                <LinearGradientBrush x:Key="ButtonBorderGradient" EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#FF4F4F4F"/>
                                    <GradientStop Color="#FF464646" Offset="1"/>
                                </LinearGradientBrush>
                                <SolidColorBrush x:Key="DisabledBrush" Color="#A5FFFFFF"/>
                            </Grid.Resources>
                            <vsm:VisualStateManager.VisualStateGroups>
                                <vsm:VisualStateGroup x:Name="CommonStates">
                                    <vsm:VisualState x:Name="Normal">
                                    </vsm:VisualState>
                                    <vsm:VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundMouseOver" Storyboard.TargetProperty="Visibility" Duration="0">
                                                <DiscreteObjectKeyFrame KeyTime="0">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Visible</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradientMouseOver" Storyboard.TargetProperty="Visibility" Duration="0">
                                                <DiscreteObjectKeyFrame KeyTime="0">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Visible</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Circle_Normal_Image" Storyboard.TargetProperty="Visibility" Duration="0">
                                                <DiscreteObjectKeyFrame KeyTime="0">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Collapsed</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Circle_Hover_Image" Storyboard.TargetProperty="Visibility" Duration="0">
                                                <DiscreteObjectKeyFrame KeyTime="0">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Visible</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </vsm:VisualState>
                                    <vsm:VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetName="Circle_Normal_Image" Storyboard.TargetProperty="(UIElement.Opacity)" Duration="0" To=".55"/>
                                            <DoubleAnimation Storyboard.TargetName="Circle_Checked_Image" Storyboard.TargetProperty="(UIElement.Opacity)" Duration="0" To="0.55"/>                                            
                                        </Storyboard>
                                    </vsm:VisualState>
                                </vsm:VisualStateGroup>
                                <vsm:VisualStateGroup x:Name="CheckStates">
                                    <vsm:VisualStateGroup.Transitions>
                                        <vsm:VisualTransition GeneratedDuration="0:0:0.2" To="Checked"/>
                                    </vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualState x:Name="Unchecked" >
                                        <Storyboard/>
                                    </vsm:VisualState>
                                    <vsm:VisualState x:Name="Checked">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundChecked" Storyboard.TargetProperty="Visibility" Duration="0">
                                                <DiscreteObjectKeyFrame KeyTime="0">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Visible</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradientChecked" Storyboard.TargetProperty="Visibility" Duration="0">
                                                <DiscreteObjectKeyFrame KeyTime="0">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Visible</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Circle_Normal_Image" Storyboard.TargetProperty="Visibility" Duration="0">
                                                <DiscreteObjectKeyFrame KeyTime="0">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Collapsed</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Circle_Checked_Image" Storyboard.TargetProperty="Visibility" Duration="0">
                                                <DiscreteObjectKeyFrame KeyTime="0">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Visible</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>                               
                                        </Storyboard>
                                    </vsm:VisualState>
                                </vsm:VisualStateGroup>
                            </vsm:VisualStateManager.VisualStateGroups>
                            <Border x:Name="Background" Visibility="Collapsed" BorderBrush="Transparent" BorderThickness="1" CornerRadius="5,5,5,5" Background="#FFA9A9A9" />
                            <Border x:Name="BackgroundGradient" Visibility="Collapsed" BorderBrush="{StaticResource ButtonBorderGradient}" BorderThickness="1" CornerRadius="5,5,5,5" >
                                <Border.Background>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#FCFFFFFF"/>
                                        <GradientStop Color="#4CFFFFFF" Offset="1"/>
                                    </LinearGradientBrush>
                                </Border.Background>
                            </Border>
                            <Border x:Name="BackgroundMouseOver" Visibility="Collapsed" BorderBrush="Transparent" BorderThickness="1" CornerRadius="5,5,5,5" Background="#FFA9A9A9" />
                            <Border x:Name="BackgroundGradientMouseOver" Visibility="Collapsed" BorderBrush="{StaticResource ButtonBorderGradient}" BorderThickness="1" CornerRadius="5,5,5,5" >
                                <Border.Background>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#FCFFFFFF"/>
                                        <GradientStop Color="#4CFFFFFF" Offset="1"/>
                                    </LinearGradientBrush>
                                </Border.Background>
                            </Border>
                            <Border x:Name="BackgroundChecked" Visibility="Collapsed" BorderBrush="Transparent" BorderThickness="1" CornerRadius="5,5,5,5" Background="#FFA9A9A9" />
                            <Border x:Name="BackgroundGradientChecked" Visibility="Collapsed" BorderBrush="{StaticResource ButtonBorderGradient}" BorderThickness="1" CornerRadius="5,5,5,5" >
                                <Border.Background>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#FCFFFFFF"/>
                                        <GradientStop Color="#4CFFFFFF" Offset="1"/>
                                    </LinearGradientBrush>
                                </Border.Background>
                            </Border>
                            <ContentPresenter x:Name="Content" Margin="4,5,4,4"  Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" />
                            <Image x:Name="Circle_Normal_Image" Margin="3" Visibility="Visible" Height="Auto" Width="Auto" VerticalAlignment="Center" HorizontalAlignment="Center" Source="/Berico.SnagL;component/Resources/Icons/SnagL/Layout_Circle.png" />
                            <Image x:Name="Circle_Hover_Image" Margin="3" Visibility="Collapsed" Height="Auto" Width="Auto" VerticalAlignment="Center" HorizontalAlignment="Center" Source="/Berico.SnagL;component/Resources/Icons/SnagL/Layout_Circle_Hover.png" />
                            <Image x:Name="Circle_Checked_Image" Margin="3" Visibility="Collapsed" Height="Auto" Width="Auto" VerticalAlignment="Center" HorizontalAlignment="Center" Source="/Berico.SnagL;component/Resources/Icons/SnagL/Layout_Circle_Hover.png" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>

    <RadioButton Style="{StaticResource RadioButtonStyle}" Command="{Binding ItemSelected}" IsEnabled="{Binding IsEnabled, Mode=TwoWay}" GroupName="Layouts" Width="35" Height="35" IsChecked="{Binding IsChecked,Mode=TwoWay}">
        <ToolTipService.ToolTip>
            <ToolTip Content="{Binding Description}" />
        </ToolTipService.ToolTip>
    </RadioButton>  

</UserControl>
